package com.bw.module_inspection.adapter

import com.bw.module_inspection.R
import com.bw.module_inspection.model.InspectionEntity
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
/**
 * 智慧园区-07-巡检管理V1.1 史建军20250513
 */
class InspectionAgentAdapter:BaseQuickAdapter<InspectionEntity,BaseViewHolder>(R.layout.item_inspection_agent_layout) {
    override fun convert(holder: BaseViewHolder, item: InspectionEntity) {
        holder.setText(R.id.tv_task,item.pointLocation)
        holder.setText(R.id.tv_type,item.patrolType)

        if (item.patrolType.equals("安防巡检")){
            holder.setBackgroundResource(R.id.tv_type,R.drawable.shape_gteen_bg)
            holder.setTextColor(R.id.tv_type,context.resources.getColor(com.bw.lib_resource.R.color.green))
            holder.setText(R.id.tv_time,"2025-05-08 09:30~10:30")
        }else if (item.patrolType.equals("日常巡检")){
            holder.setBackgroundResource(R.id.tv_type,R.drawable.shape_blue_bg)
            holder.setTextColor(R.id.tv_type,context.resources.getColor(com.bw.lib_resource.R.color.blue))
            holder.setText(R.id.tv_time,"2025-05-08 19:30~20:30")
        }else if (item.patrolType.equals("家居巡检")){
            holder.setBackgroundResource(R.id.tv_type,R.drawable.shape_purple_bg)
            holder.setTextColor(R.id.tv_type,context.resources.getColor(com.bw.lib_resource.R.color.purple))
            holder.setText(R.id.tv_time,"2025-05-08 10:30~11:30")
        }else{
            holder.setBackgroundResource(R.id.tv_type,R.drawable.shape_orange_bg)
            holder.setTextColor(R.id.tv_type,context.resources.getColor(com.bw.lib_resource.R.color.orange))
            holder.setText(R.id.tv_time,"2025-05-08 11:30~12:30")
        }

    }
}